Kinetis SDK API Reference Manual  1.0.0-beta
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
FlexTimer HAL driver

The section describes the programming interface of the FlexTimer HAL driver. More...

Data Structures

union  ftm_edge_mode_t
 FlexTimer edge mode. More...
 
struct  ftm_config_t
 FlexTimer module configuration. More...
 

Macros

#define HW_FTM_CHANNEL_COUNT   (8U)
 Number of channels for one FTM instance. More...
 
#define HW_FTM_CHANNEL_PAIR_COUNT   (4U)
 Number of combined channel of one FTM instance. More...
 
#define HW_CHAN0   (0U)
 Channel number for CHAN0. More...
 
#define HW_CHAN1   (1U)
 Channel number for CHAN1. More...
 
#define HW_CHAN2   (2U)
 Channel number for CHAN2. More...
 
#define HW_CHAN3   (3U)
 Channel number for CHAN3. More...
 
#define HW_CHAN4   (4U)
 Channel number for CHAN4. More...
 
#define HW_CHAN5   (5U)
 Channel number for CHAN5. More...
 
#define HW_CHAN6   (6U)
 Channel number for CHAN6. More...
 
#define HW_CHAN7   (7U)
 Channel number for CHAN7. More...
 
#define FTM_COMBINE_CHAN_CTRL_WIDTH   (8U)
 

Enumerations

enum  ftm_clock_source_t {
  kClock_source_FTM_None = 0,
  kClock_source_FTM_SystemClk,
  kClock_source_FTM_FixedClk,
  kClock_source_FTM_ExternalClk
}
 FlexTimer clock source selection.
 
enum  ftm_counting_mode_t {
  kCounting_FTM_UP = 0,
  kCounting_FTM_Down
}
 FlexTimer counting mode, up-down.
 
enum  ftm_clock_ps_t {
  kFtmDividedBy1 = 0,
  kFtmDividedBy2,
  kFtmDividedBy4,
  kFtmDividedBy8,
  kFtmDividedBy16,
  kFtmDividedBy32,
  kFtmDividedBy64,
  kFtmDividedBy128
}
 FlexTimer pre-scaler factor selection for the clock source.
 
enum  ftm_phase_t {
  kFtmPhaseA = 0,
  kFtmPhaseB
}
 FlexTimer phase for the quadrature.
 
enum  ftm_deadtime_ps_t {
  kFtmDivided0 = 0,
  kFtmDivided1 = 1,
  kFtmDivided4 = 2,
  kFtmDivided16 = 3
}
 FlexTimer pre-scaler factor for the deadtime insertion.
 
enum  ftm_config_mode_t {
  kFtmInputCapture,
  kFtmOutputCompare,
  kFtmEdgeAlignedPWM,
  kFtmCenterAlignedPWM,
  kFtmCombinedPWM,
  kFtmDualEdgeCapture,
  kFtmQuadCapture
}
 FlexTimer operation mode, capture, output, dual, or quad.
 
enum  ftm_input_capture_edge_mode_t {
  kFtmRisingEdge = 0,
  kFtmFallingEdge,
  kFtmRisingAndFalling
}
 FlexTimer input capture edge mode, rising edge, or falling edge.
 
enum  ftm_output_compare_edge_mode_t {
  kFtmToggleOnMatch = 0,
  kFtmClearOnMatch,
  kFtmSetOnMatch
}
 FlexTimer output compare edge mode. More...
 
enum  ftm_pwm_edge_mode_t {
  kFtmHighTrue = 0,
  kFtmLowTrue
}
 FlexTimer PWM output pulse mode, high-true or low-true on match up.
 
enum  ftm_dual_capture_edge_mode_t {
  kFtmOneShout = 0,
  kFtmContinuous
}
 FlexTimer dual capture edge mode, one shot or continuous.
 

Functions

static void ftm_hal_set_clock_source (uint8_t instance, ftm_clock_source_t clock)
 Sets the FTM clock source. More...
 
static void ftm_hal_set_clock_ps (uint8_t instance, ftm_clock_ps_t ps)
 Sets the FTM clock divider. More...
 
static void ftm_hal_enable_timer_overflow_interrupt (uint8_t instance)
 Enables the FTM peripheral timer overflow interrupt. More...
 
static void ftm_hal_disable_timer_overflow_interrupt (uint8_t instance)
 Disables the FTM peripheral timer overflow interrupt. More...
 
static bool ftm_is_timer_overflow (uint8_t instance)
 Returns the FTM peripheral timer overflow interrupt flag. More...
 
static void ftm_hal_set_cpwms (uint8_t instance, uint8_t mode)
 Sets the FTM center-aligned PWM select. More...
 
static void ftm_hal_set_counter (uint8_t instance, uint16_t val)
 Sets the FTM peripheral current counter value. More...
 
static uint16_t ftm_hal_get_counter (uint8_t instance)
 Returns the FTM peripheral current counter value. More...
 
static void ftm_hal_set_mod (uint8_t instance, uint16_t val)
 Sets the FTM peripheral timer modulo value. More...
 
static uint16_t ftm_hal_get_mod (uint8_t instance)
 Returns the FTM peripheral counter modulo value. More...
 
static void ftm_hal_set_counter_init_val (uint8_t instance, uint16_t val)
 Sets the FTM peripheral timer counter initial value. More...
 
static uint16_t ftm_hal_get_counter_init_val (uint8_t instance)
 Returns the FTM peripheral counter initial value. More...
 
static void ftm_hal_set_channel_MSnBA_mode (uint8_t instance, uint8_t channel, uint8_t selection)
 Sets the FTM peripheral timer channel mode. More...
 
static void ftm_hal_set_channel_edge_level (uint8_t instance, uint8_t channel, uint8_t level)
 Sets the FTM peripheral timer channel edge level. More...
 
static uint8_t ftm_hal_get_channel_mode (uint8_t instance, uint8_t channel)
 Gets the FTM peripheral timer channel mode. More...
 
static uint8_t ftm_hal_get_channel_edge_level (uint8_t instance, uint8_t channel)
 Gets the FTM peripheral timer channel edge level. More...
 
static void ftm_hal_enable_channle_dma (uint8_t instance, uint8_t channel, bool val)
 Enables or disables the FTM peripheral timer channel DMA. More...
 
static bool ftm_hal_is_channel_dma (uint8_t instance, uint8_t channel, bool val)
 Returns whether the FTM peripheral timer channel DMA is enabled. More...
 
static void ftm_hal_enable_channel_interrupt (uint8_t instance, uint8_t channel)
 Enables the FTM peripheral timer channel(n) interrupt. More...
 
static void ftm_hal_disable_channel_interrupt (uint8_t instance, uint8_t channel)
 Disables the FTM peripheral timer channel(n) interrupt. More...
 
static bool ftm_is_channel_event_occurred (uint8_t instance, uint8_t channel)
 Returns whether any event for the FTM peripheral timer channel has occurred. More...
 
static void ftm_hal_set_channel_count_value (uint8_t instance, uint8_t channel, uint16_t val)
 Sets the FTM peripheral timer channel counter value. More...
 
static uint16_t ftm_hal_get_channel_count_value (uint8_t instance, uint8_t channel, uint16_t val)
 Gets the FTM peripheral timer channel counter value. More...
 
static uint32_t ftm_hal_get_channel_event_status (uint8_t instance, uint8_t channel)
 Gets the FTM peripheral timer channel event status. More...
 
static void ftm_hal_clear_channel_event_status (uint8_t instance, uint8_t channel)
 Clears the FTM peripheral timer all channel event status. More...
 
static void ftm_hal_set_channel_output_mask (uint8_t instance, uint8_t channel, bool mask)
 Sets the FTM peripheral timer channel output mask. More...
 
static void ftm_hal_set_channel_output_init_state (uint8_t instance, uint8_t channel, uint8_t state)
 Sets the FTM peripheral timer channel output initial state 0 or 1. More...
 
static void ftm_hal_set_channel_output_polarity (uint8_t instance, uint8_t channel, uint8_t pol)
 Sets the FTM peripheral timer channel output polarity. More...
 
static void ftm_hal_set_channel_fault_input_polarity (uint8_t instance, uint8_t channel, uint8_t pol)
 Sets the FTM peripheral timer channel input polarity. More...
 
static void ftm_hal_enable_fault_interrupt (uint8_t instance)
 Enables the FTM peripheral timer fault interrupt. More...
 
static void ftm_hal_disable_fault_interrupt (uint8_t instance)
 Disables the FTM peripheral timer fault interrupt. More...
 
static void ftm_hal_set_fault_control_mode (uint8_t instance, uint8_t mode)
 Sets the FTM peripheral timer fault control mode. More...
 
static void ftm_hal_enable_capture_test (uint8_t instance, bool enable)
 Enables the FTM peripheral timer capture test. More...
 
static void ftm_hal_enable_write_protection (uint8_t instance, bool enable)
 Enables the FTM peripheral timer write protection. More...
 
static void ftm_hal_ftm_enable (uint8_t instance, bool enable)
 Enables the FTM peripheral timer group. More...
 
static void ftm_hal_enable_channel_init_output (uint8_t instance, bool enable)
 Enables the FTM peripheral timer channel output initialization. More...
 
static void ftm_hal_set_pwm_sync_mdoe (uint8_t instance, bool enable)
 Sets the FTM peripheral timer sync mode. More...
 
static void ftm_hal_enable_software_trigger (uint8_t instance, bool enable)
 Enables the FTM peripheral timer software trigger. More...
 
void ftm_hal_set_hardware_trigger (uint8_t instance, uint8_t trigger_num, bool enable)
 Sets the FTM peripheral timer hardware trigger. More...
 
static void ftm_hal_enable_output_mask_sync_by_pwm (uint8_t instance, bool enable)
 Enables the FTM peripheral timer output mask update by PWM sync. More...
 
static void ftm_hal_enable_count_reinit_sync (uint8_t instance, bool enable)
 Enables the FTM peripheral timer counter re-initialized by sync. More...
 
static void ftm_hal_enable_max_loading (uint8_t instance, bool enable)
 Enables the FTM peripheral timer maximum loading points. More...
 
static void ftm_hal_enable_min_loading (uint8_t instance, bool enable)
 Enables the FTM peripheral timer minimum loading points. More...
 
static uint32_t get_channel_pair_index (uint8_t channel)
 Combines the channel control. More...
 
static void ftm_hal_enable_dual_capture (uint8_t instance, uint8_t channel, bool enable)
 Enables the FTM peripheral timer dual edge capture mode. More...
 
static void ftm_hal_enable_dual_channel_fault (uint8_t instance, uint8_t channel, bool enable)
 Enables the FTM peripheral timer channel pair fault control. More...
 
static void ftm_hal_enable_dual_channel_pwm_sync (uint8_t instance, uint8_t channel, bool enable)
 Enables the FTM peripheral timer channel pair counter PWM sync. More...
 
static void ftm_hal_enable_dual_channel_deadtime (uint8_t instance, uint8_t channel, bool enable)
 Enables the FTM peripheral timer channel pair deadtime. More...
 
static void ftm_hal_enable_dual_channel_decap (uint8_t instance, uint8_t channel, bool enable)
 Enables the FTM peripheral timer channel dual edge capture decap, not decapen. More...
 
static void ftm_hal_enable_dual_channel_comp (uint8_t instance, uint8_t channel, bool enable)
 Enables the FTM peripheral timer channel pair output complement mode. More...
 
static void ftm_hal_enable_dual_channel_combine (uint8_t instance, uint8_t channel, bool enable)
 Enables the FTM peripheral timer channel pair output combine mode. More...
 
static void ftm_hal_set_deadtime_prescale (uint8_t instance, ftm_deadtime_ps_t divider)
 Set the FTM deadtime divider. More...
 
static void ftm_hal_set_deadtime_count (uint8_t instance, uint8_t count)
 Sets the FTM deadtime value. More...
 
void ftm_hal_enable_channel_trigger (uint8_t instance, uint8_t channel, bool val)
 Enables the generation of the FTM peripheral timer channel trigger when the FTM counter is equal to its initial value. More...
 
static bool ftm_hal_is_channel_trigger_generated (uint8_t instance, uint8_t channel)
 Checks whether any channel trigger event has occurred. More...
 
static uint8_t ftm_hal_get_detected_fault_input (uint8_t instance)
 Gets the FTM detected fault input. More...
 
static bool ftm_hal_is_write_protection_enable (uint8_t instance)
 Checks whether the write protection is enabled. More...
 
static void ftm_hal_enable_quad_capture (uint8_t instance, bool enable)
 Enables the channel quadrature decoder. More...
 
void ftm_hal_set_channel_input_capture_filter (uint8_t instance, uint8_t channel, uint8_t val)
 Sets the FTM peripheral timer channel input capture filter value. More...
 
static void ftm_hal_enable_channel_fault_input_filter (uint8_t instance, uint8_t channel, bool val)
 Enables the channel input filter. More...
 
static void ftm_hal_enable_channel_fault_input (uint8_t instance, uint8_t channel, bool val)
 Enables the channel fault input. More...
 
static void ftm_hal_enable_dual_channel_invert (uint8_t instance, uint8_t channel, bool val)
 Enables the channel invert. More...
 
static void ftm_hal_enable_channel_software_ctrl (uint8_t instance, uint8_t channel, bool val)
 Enables the channel software control. More...
 
static void ftm_hal_set_channel_software_ctrl_val (uint8_t instance, uint8_t channel, bool val)
 Sets the channel software control value. More...
 
static void ftm_hal_enable_pwm_load (uint8_t instance, bool enable)
 Enables the FTM timer PWM loading of MOD, CNTIN and CV. More...
 
static void ftm_hal_enable_pwm_load_matching_channel (uint8_t instance, uint8_t channel, bool val)
 Enables the channel matching process. More...
 
static void ftm_hal_enable_global_time_base_output (uint8_t instance, bool enable)
 Enables the FTM timer global time base output. More...
 
static void ftm_hal_enable_global_time_base (uint8_t instance, bool enable)
 Enables the FTM timer global time base. More...
 
static void ftm_hal_set_bdm_mode (uint8_t instance, uint8_t val)
 Sets the FTM timer TOF Frequency. More...
 
static void ftm_hal_set_tof_frequency (uint8_t instance, uint8_t val)
 Sets the BDM mode. More...
 
static void ftm_hal_enable_hardware_sync_software_output_ctrl (uint8_t instance, bool enable)
 Enables the FTM timer hardware sync activation. More...
 
static void ftm_hal_enable_hardware_sync_invert_ctrl (uint8_t instance, bool enable)
 Enables the FTM timer hardware inverting control sync. More...
 
static void ftm_hal_enable_hardware_sync_output_mask (uint8_t instance, bool enable)
 Enables the FTM timer hardware outmask sync. More...
 
static void ftm_hal_enable_hardware_sycn_mod_cntin_cv (uint8_t instance, bool enable)
 MOD, CNTIN, and CV registers synchronization is activated. More...
 
static void ftm_hal_enable_hardware_sync_counter (uint8_t instance, bool enable)
 The FTM counter synchronization is activated by a hardware trigger. More...
 
static void ftm_hal_enable_pwm_sync_swoctrl (uint8_t instance, bool enable)
 Enables the FTM timer software sync activation. More...
 
static void ftm_hal_enable_enhanced_pwm_sync_mdoe (uint8_t instance, bool enable)
 Enables the FTM timer enhanced PWM sync mode. More...
 
static void ftm_hal_enable_software_sync_swoctrl (uint8_t instance, bool enable)
 Enables the FTM timer software output control sync. More...
 
static void ftm_hal_enable_software_sync_invert_ctrl (uint8_t instance, bool enable)
 Enables the FTM timer software inverting control sync. More...
 
static void ftm_hal_enable_software_sync_output_mask (uint8_t instance, bool enable)
 Enables the FTM timer software outmask sync. More...
 
static void ftm_hal_enable_software_sycn_mod_cntin_cv (uint8_t instance, bool enable)
 Enables the FTM timer software outmask sync. More...
 
static void ftm_hal_enable_software_sync_counter (uint8_t instance, bool enable)
 Enables the FTM timer counter software sync. More...
 
static void ftm_hal_enable_invert_sync_with_rising_edge (uint8_t instance, bool enable)
 Enables the FTM timer INVCTRL update by PWM. More...
 
static void ftm_hal_enable_cntin_sync_with_rising_edge (uint8_t instance, bool enable)
 Enables the FTM timer cntin update by PWM. More...
 
void ftm_hal_reset (uint8_t instance)
 Resets the FTM registers. More...
 
void ftm_hal_init (uint8_t instance, ftm_config_t *config)
 Initializes the FTM. More...
 
void ftm_hal_enable_pwm_mode (uint8_t instance, ftm_config_t *config)
 Enables the FTM timer when it is PWM output mode. More...
 
void ftm_hal_disable_pwm_mode (uint8_t instance, ftm_config_t *config)
 Initializes the FTM timer when it is PWM output mode. More...
 

Data Structure Documentation

union ftm_edge_mode_t

Data Fields

ftm_input_capture_edge_mode_t input_capture_edge_mode
 
ftm_output_compare_edge_mode_t output_compare_edge_mode
 
ftm_pwm_edge_mode_t ftm_pwm_edge_mode
 
ftm_dual_capture_edge_mode_t ftm_dual_capture_edge_mode
 
struct ftm_config_t

Data Fields

ftm_config_mode_t mode
 
uint8_t channel
 
ftm_edge_mode_t edge_mode
 

Macro Definition Documentation

#define HW_FTM_CHANNEL_COUNT   (8U)
#define HW_FTM_CHANNEL_PAIR_COUNT   (4U)
#define HW_CHAN0   (0U)
#define HW_CHAN1   (1U)
#define HW_CHAN2   (2U)
#define HW_CHAN3   (3U)
#define HW_CHAN4   (4U)
#define HW_CHAN5   (5U)
#define HW_CHAN6   (6U)
#define HW_CHAN7   (7U)

Enumeration Type Documentation

Toggle, clear or set.

Function Documentation

static void ftm_hal_set_clock_source ( uint8_t  instance,
ftm_clock_source_t  clock 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
clockThe FTM peripheral clock selection bits:00: No clock 01: system clock 10 :fixed clock 11:External clock
static void ftm_hal_set_clock_ps ( uint8_t  instance,
ftm_clock_ps_t  ps 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
psThe FTM peripheral clock pre-scale divider
static void ftm_hal_enable_timer_overflow_interrupt ( uint8_t  instance)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
static void ftm_hal_disable_timer_overflow_interrupt ( uint8_t  instance)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
static bool ftm_is_timer_overflow ( uint8_t  instance)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
Return values
trueif overflow, false if not
static void ftm_hal_set_cpwms ( uint8_t  instance,
uint8_t  mode 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
mode1:upcounting mode 0:up_down counting mode
static void ftm_hal_set_counter ( uint8_t  instance,
uint16_t  val 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
valFTM timer counter value to be set
static uint16_t ftm_hal_get_counter ( uint8_t  instance)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
Return values
currentFTM timer counter value
static void ftm_hal_set_mod ( uint8_t  instance,
uint16_t  val 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
valThe value to be set to the timer modulo
static uint16_t ftm_hal_get_mod ( uint8_t  instance)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
Return values
FTMtimer modulo value
static void ftm_hal_set_counter_init_val ( uint8_t  instance,
uint16_t  val 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
valinitial value to be set
static uint16_t ftm_hal_get_counter_init_val ( uint8_t  instance)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
Return values
FTMtimer counter initial value
static void ftm_hal_set_channel_MSnBA_mode ( uint8_t  instance,
uint8_t  channel,
uint8_t  selection 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
selectionThe mode to be set valid value MSnB:MSnA :00,01, 10, 11
static void ftm_hal_set_channel_edge_level ( uint8_t  instance,
uint8_t  channel,
uint8_t  level 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
levelThe rising or falling edge to be set, valid value ELSnB:ELSnA :00,01, 10, 11
static uint8_t ftm_hal_get_channel_mode ( uint8_t  instance,
uint8_t  channel 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
Return values
TheMSnB:MSnA mode value, will be 00,01, 10, 11
static uint8_t ftm_hal_get_channel_edge_level ( uint8_t  instance,
uint8_t  channel 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
Return values
TheELSnB:ELSnA mode value, will be 00,01, 10, 11
static void ftm_hal_enable_channle_dma ( uint8_t  instance,
uint8_t  channel,
bool  val 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
valenable or disable
static bool ftm_hal_is_channel_dma ( uint8_t  instance,
uint8_t  channel,
bool  val 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
Return values
trueif enabled, false if disabled
static void ftm_hal_enable_channel_interrupt ( uint8_t  instance,
uint8_t  channel 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
static void ftm_hal_disable_channel_interrupt ( uint8_t  instance,
uint8_t  channel 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
static bool ftm_is_channel_event_occurred ( uint8_t  instance,
uint8_t  channel 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
Return values
trueif event occurred, false otherwise.
static void ftm_hal_set_channel_count_value ( uint8_t  instance,
uint8_t  channel,
uint16_t  val 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
valcounter value to be set
static uint16_t ftm_hal_get_channel_count_value ( uint8_t  instance,
uint8_t  channel,
uint16_t  val 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
Return values
valreturn current channel counter value
static uint32_t ftm_hal_get_channel_event_status ( uint8_t  instance,
uint8_t  channel 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
Return values
valreturn current channel event status value
static void ftm_hal_clear_channel_event_status ( uint8_t  instance,
uint8_t  channel 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
Return values
valreturn current channel counter value
static void ftm_hal_set_channel_output_mask ( uint8_t  instance,
uint8_t  channel,
bool  mask 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
maskmask to be set 0 or 1, unmasked or masked
static void ftm_hal_set_channel_output_init_state ( uint8_t  instance,
uint8_t  channel,
uint8_t  state 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
statecounter value to be set 0 or 1
static void ftm_hal_set_channel_output_polarity ( uint8_t  instance,
uint8_t  channel,
uint8_t  pol 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
polpolarity to be set 0 or 1
static void ftm_hal_set_channel_fault_input_polarity ( uint8_t  instance,
uint8_t  channel,
uint8_t  pol 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
polpolarity to be set, 0: active high, 1:active low
static void ftm_hal_enable_fault_interrupt ( uint8_t  instance)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
static void ftm_hal_disable_fault_interrupt ( uint8_t  instance)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
static void ftm_hal_set_fault_control_mode ( uint8_t  instance,
uint8_t  mode 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
mode,validnumber bits:00, 01, 10,11 (1, 2, 3, 4)
static void ftm_hal_enable_capture_test ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enabletrue to enable, false to disable
static void ftm_hal_enable_write_protection ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enabletrue to enable, false to disable
static void ftm_hal_ftm_enable ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to enable, false to disable
static void ftm_hal_enable_channel_init_output ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to enable, false to disable
static void ftm_hal_set_pwm_sync_mdoe ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue no restriction both software and hardware sync, false only software sync.
static void ftm_hal_enable_software_trigger ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number.
enableTrue to enable, false to disable
void ftm_hal_set_hardware_trigger ( uint8_t  instance,
uint8_t  trigger_num,
bool  enable 
)
Parameters
instanceThe FTM peripheral instance number
trigger_num0, 1,2 for trigger0, trigger1 and trigger3
enableTrue to enable, 1 to enable
static void ftm_hal_enable_output_mask_sync_by_pwm ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to enable PWM sync, false to enable outmask in the rising edges of the system clock
static void ftm_hal_enable_count_reinit_sync ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to update FTM counter when triggered , false to count normally
static void ftm_hal_enable_max_loading ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to enable, false to disable
static void ftm_hal_enable_min_loading ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to enable, false to disable
static uint32_t get_channel_pair_index ( uint8_t  channel)
static

Returns an index for each channel pair.

Parameters
channelThe FTM peripheral channel number.
Returns
0 for channel pair 0 & 1
1 for channel pair 2 & 3
2 for channel pair 4 & 5
3 for channel pair 6 & 7
static void ftm_hal_enable_dual_capture ( uint8_t  instance,
uint8_t  channel,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
enableTrue to enable, false to disable
static void ftm_hal_enable_dual_channel_fault ( uint8_t  instance,
uint8_t  channel,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
enableTrue to enable, false to disable
static void ftm_hal_enable_dual_channel_pwm_sync ( uint8_t  instance,
uint8_t  channel,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
enableTrue to enable, false to disable
static void ftm_hal_enable_dual_channel_deadtime ( uint8_t  instance,
uint8_t  channel,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
enableTrue to enable, false to disable
static void ftm_hal_enable_dual_channel_decap ( uint8_t  instance,
uint8_t  channel,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
enableTrue to enable, false to disable
static void ftm_hal_enable_dual_channel_comp ( uint8_t  instance,
uint8_t  channel,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
enableTrue to enable, false to disable
static void ftm_hal_enable_dual_channel_combine ( uint8_t  instance,
uint8_t  channel,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
enableTrue to enable channel pair to combine, false to disable
static void ftm_hal_set_deadtime_prescale ( uint8_t  instance,
ftm_deadtime_ps_t  divider 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
dividerThe FTM peripheral prescale divider 0x :divided by 1, 10: divided by 4 11:divided by 16
static void ftm_hal_set_deadtime_count ( uint8_t  instance,
uint8_t  count 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
dividerThe FTM peripheral prescale divider count: 0, no counts inserted 1: 1 count is inserted 2: 2 count is inserted....
void ftm_hal_enable_channel_trigger ( uint8_t  instance,
uint8_t  channel,
bool  val 
)

Channels 6 and 7 cannot be used as triggers.

Parameters
instanceThe FTM peripheral instance number
channelChannel to be enabled, valid value 0, 1, 2, 3, 4, 5
enableTrue to enable, false to disable
static bool ftm_hal_is_channel_trigger_generated ( uint8_t  instance,
uint8_t  channel 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
Return values
Trueif there is a trigger event, false if not.
static uint8_t ftm_hal_get_detected_fault_input ( uint8_t  instance)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
Return values
Returnfaulty byte
static bool ftm_hal_is_write_protection_enable ( uint8_t  instance)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
Return values
Trueif enabled, false if not
static void ftm_hal_enable_quad_capture ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to enable, false to disable
void ftm_hal_set_channel_input_capture_filter ( uint8_t  instance,
uint8_t  channel,
uint8_t  val 
)
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number, only 0,1,2,3, channel 4, 5,6, 7 don't have.
valFilter value to be set
static void ftm_hal_enable_channel_fault_input_filter ( uint8_t  instance,
uint8_t  channel,
bool  val 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelChannel to be enabled, valid value 0, 1, 2, 3
enableTrue to enable, false to disable
static void ftm_hal_enable_channel_fault_input ( uint8_t  instance,
uint8_t  channel,
bool  val 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelChannel to be enabled, valid value 0, 1, 2, 3
enableTrue to enable, false to disable
static void ftm_hal_enable_dual_channel_invert ( uint8_t  instance,
uint8_t  channel,
bool  val 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelThe FTM peripheral channel number
enableTrue to enable, false to disable
static void ftm_hal_enable_channel_software_ctrl ( uint8_t  instance,
uint8_t  channel,
bool  val 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelChannel to be enabled, valid value 0, 1, 2, 3, 4,5,6,7
enableTrue to enable, false to disable
static void ftm_hal_set_channel_software_ctrl_val ( uint8_t  instance,
uint8_t  channel,
bool  val 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number.
channelChannel to be enabled, valid value 0, 1, 2, 3,5,6,7,
boolTrue to set 1, false to set 0
static void ftm_hal_enable_pwm_load ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to enable, false to disable
static void ftm_hal_enable_pwm_load_matching_channel ( uint8_t  instance,
uint8_t  channel,
bool  val 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
channelChannel to be enabled, valid value 0, 1, 2, 3, 4,5,6,7
enableTrue to enable, false to disable
static void ftm_hal_enable_global_time_base_output ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to enable, false to disable
static void ftm_hal_enable_global_time_base ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to enable, false to disable
static void ftm_hal_set_bdm_mode ( uint8_t  instance,
uint8_t  val 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
valValue of the TOF bit set frequency
static void ftm_hal_set_tof_frequency ( uint8_t  instance,
uint8_t  val 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
valValue of the TOF bit set frequency
static void ftm_hal_enable_hardware_sync_software_output_ctrl ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to enable, false to disable
static void ftm_hal_enable_hardware_sync_invert_ctrl ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to enable, false to disable
static void ftm_hal_enable_hardware_sync_output_mask ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to enable, false to disable
static void ftm_hal_enable_hardware_sycn_mod_cntin_cv ( uint8_t  instance,
bool  enable 
)
inlinestatic

A hardware trigger activates the synchronization.

Parameters
instanceThe FTM peripheral instance number
enableTrue to enable, false to disable
static void ftm_hal_enable_hardware_sync_counter ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to enable, false to disable
static void ftm_hal_enable_pwm_sync_swoctrl ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to enable, false to disable
static void ftm_hal_enable_enhanced_pwm_sync_mdoe ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to enable, false to disable
static void ftm_hal_enable_software_sync_swoctrl ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to enable, false to disable
static void ftm_hal_enable_software_sync_invert_ctrl ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to enable, false to disable
static void ftm_hal_enable_software_sync_output_mask ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to enable, false to disable
static void ftm_hal_enable_software_sycn_mod_cntin_cv ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to enable, false to disable.
static void ftm_hal_enable_software_sync_counter ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to enable, false to disable
static void ftm_hal_enable_invert_sync_with_rising_edge ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to update with PWM, false to update with rising edge of system clock.
static void ftm_hal_enable_cntin_sync_with_rising_edge ( uint8_t  instance,
bool  enable 
)
inlinestatic
Parameters
instanceThe FTM peripheral instance number
enableTrue to update with PWM, false to update with rising edge of system clock.
void ftm_hal_reset ( uint8_t  instance)
Parameters
instanceThe FTM peripheral instance number
void ftm_hal_init ( uint8_t  instance,
ftm_config_t config 
)
Parameters
instanceThe FTM peripheral instance number.
void ftm_hal_enable_pwm_mode ( uint8_t  instance,
ftm_config_t config 
)
Parameters
instanceThe FTM peripheral instance number
configpwm config parameter
void ftm_hal_disable_pwm_mode ( uint8_t  instance,
ftm_config_t config 
)
Parameters
instanceThe FTM peripheral instance number